<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>修改密码</title>
    <link href="__PUBLIC__/css/Change password.css" rel="stylesheet" type="text/css">
    <script type="text/javascript"src="__PUBLIC__/js/jquery-1.12.1.js"></script>
</head>
<body>
<div class="All">
    <div class="content">
        <div class="old line">
            <div class="older">原密码：</div>
            <input type="password" id="older">
        </div>
        <div class="new line">
            <div class="newer">新密码：</div>
            <input type="text" id="psw1">
        </div>
        <div class="new line">
            <div class="newer">再次输入：</div>
            <input type="password" id="psw2">
        </div>
    </div>
    <div class="button">确定</div>
</div>

</body>
</html>
<script>
    $(function(){
        $(".button").click(function(){
            var oldPsw= $("#older").val();
            var newPsw1= $("#psw1").val();
            var newPsw2= $("#psw2").val();
            var psw="{$psw}";
            if(oldPsw!=psw){
                alert("对不起，原密码有误");
                location.reload();
            }else if(newPsw1!=newPsw2){
                alert("对不起，两次输入密码不一致");
                location.reload();
            }else {
                var href="{:U('change',array('npsw'=>'newpassword'))}";
                href=href.replace("newpassword",newPsw1);
                location.href=href;
            }
        });
    });
</script>